<!--
 * @Author: liaoxing
 * @Date: 2022-01-11 16:02:26
 * @LastEditors: liaoxing
 * @LastEditTime: 2022-03-22 14:45:37
 * @Description: liaoxing created
 * @FilePath: \pin-xin-admin\src\components\DownLoadFiles\index.vue
-->
<template>
  <div class="DownLoadFiles">
    <span @click="download">{{ title || '下载' }}</span>
  </div>
</template>

<script>
export default {
  name: "DownLoadFiles",
  props: ['id', 'url', 'title'],
  methods: {
    download () {
      window.open(this.url)
      // this.$quote.downLoadFile(this.id)
      //     .then((res) => {
      //       console.log(res)
      //       let blob = new Blob([res.data],{type: 'application/json'})
      //       let fileName  = 'ss.xlsx'

      //       if(typeof window.navigator.msSaveBlob !== 'undefined') {//兼容ie
      //           window.navigator.msSaveBlob(blob, fileName);
      //       }else {
      //         let URL = window.URL || window.webkitURL
      //         let objectUrl = URL.createObjectURL(blob)
      //         if (fileName) {
      //           var a = document.createElement('a')
      //           if (typeof a.download === 'undefined') {
      //               window.location = objectUrl
      //           } else {
      //               a.href = objectUrl
      //               a.download = fileName
      //               document.body.appendChild(a)
      //               a.click()
      //               a.remove();
      //           }
      //         }else {
      //           window.location = objectUrl
      //         }
      //       }
      //     })
      //     .catch(err => {
      //       this.$message.error(JSON.stringify(err))
      //     }
        // )

    }
  }
}
</script>

<style lang="less">
.DownLoadFiles{
  display: inline-block;
  color: #3377FF;
  span{
    cursor: pointer;
  }
}
</style>